package com.hd.entity.sys;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hd.util.report.excel.ExcelCellType;
import com.hd.util.report.excel.ExcelField;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 用户表
 * </p>
 */
@Entity
@Table(name = "sys_user")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    private String id;
    /**
     * 姓名
     */
    private String name;
    /**
     * 登录名
     */
    @ExcelField(value = "登录名", type = ExcelCellType.TEXT, order = 1)
    private String username;
    /**
     * 密码
     */
    @JsonIgnore
    private String password;
    /**
     * 盐
     */
    @JsonIgnore
    private String salt;
    /**
     * 身份证号码
     */
    @Column(name = "id_card")
    private String idCard;
    /**
     * 所属部门ID
     */
    @Column(name = "org_id")
    private String orgId;
    /**
     * 所属部门名称
     */
    private String orgName;
    /**
     * 性别 1-男,0-女,2-保密
     */
    @ExcelField(value = "性别", type = ExcelCellType.NUMBER, order = 4)
    private Integer sex;
    /**
     * 手机号
     */
    @ExcelField(value = "手机号", type = ExcelCellType.TEXT, order = 3)
    private String phone;
    /**
     * 状态 1-正常/有效 0-停用/无效
     */
    private Integer status;
    /**
     * 上级ID
     */
    private String superior;
    /**
     * 上级名字
     */
    @Column(name = "superior_name")
    private String superiorName;
    /**
     * 创建时间
     */
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time")
    private Date createTime;
    /**
     * 角色ID列表
     */
    @Transient
    private String roleIdList;
    /**
     * 角色名列表
     */
    @Transient
    private String roleNameList;
    /**
     * 角色列表
     */
    @Transient
    private List<Role> roleList = new ArrayList<Role>();
    /**
     * 职位ID
     */
    @Column(name = "position_id")
    private String positionId;
    /**
     * 职位名称
     */
    @Transient
    private String positionName;
    /**
     * 控制显示和隐藏 true-显示,false-隐藏
     */
    @Column(name = "is_show")
    private Boolean show = true;
    /**
     * 用户其他信息
     */
    @Transient
    private UserInfoExt userInfoExt;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getOrgId() {
        return orgId;
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getRoleIdList() {
        return roleIdList;
    }

    public void setRoleIdList(String roleIdList) {
        this.roleIdList = roleIdList;
    }

    public String getRoleNameList() {
        return roleNameList;
    }

    public void setRoleNameList(String roleNameList) {
        this.roleNameList = roleNameList;
    }

    public List<Role> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<Role> roleList) {
        this.roleList = roleList;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSuperior() {
        return superior;
    }

    public void setSuperior(String superior) {
        this.superior = superior;
    }

    public String getSuperiorName() {
        return superiorName;
    }

    public void setSuperiorName(String superiorName) {
        this.superiorName = superiorName;
    }

    public String getPositionId() {
        return positionId;
    }

    public void setPositionId(String positionId) {
        this.positionId = positionId;
    }

    public String getPositionName() {
        return positionName;
    }

    public void setPositionName(String positionName) {
        this.positionName = positionName;
    }

    public Boolean getShow() {
        return show;
    }

    public void setShow(Boolean show) {
        this.show = show;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public UserInfoExt getUserInfoExt() {
        return userInfoExt;
    }

    public void setUserInfoExt(UserInfoExt userInfoExt) {
        this.userInfoExt = userInfoExt;
    }

    @Override
    public String toString() {
        return "User{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", salt='" + salt + '\'' +
                ", idCard='" + idCard + '\'' +
                ", orgId='" + orgId + '\'' +
                ", orgName='" + orgName + '\'' +
                ", sex=" + sex +
                ", phone='" + phone + '\'' +
                ", status=" + status +
                ", superior='" + superior + '\'' +
                ", superiorName='" + superiorName + '\'' +
                ", createTime=" + createTime +
                ", roleIdList='" + roleIdList + '\'' +
                ", roleNameList='" + roleNameList + '\'' +
                ", roleList=" + roleList +
                ", positionId='" + positionId + '\'' +
                ", positionName='" + positionName + '\'' +
                ", show=" + show +
                ", userInfoExt=" + userInfoExt +
                '}';
    }
}
